package com.midongtech.cpd;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.midongtech.cpd.utils.AppUtils;
import com.midongtech.cpd.utils.CommonCallBack;
import com.midongtech.cpd.utils.CpdEncryptUtil;
import com.midongtech.cpd.utils.DeviceUtil;
import com.midongtech.cpd.utils.HttpManager;

public class MainActivity extends AppCompatActivity {

    private Context mContext;
    private String[] permission = {Manifest.permission.READ_PHONE_STATE};


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mContext = getApplicationContext();
        if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(this, permission, 98);
        }

        //上传app列表
        HttpManager.uploadApplist(mContext, new CommonCallBack() {
            @Override
            public void onSuccess(String response) {
                Log.i("cpd","uploadApplist onSuccess:"+response);
            }

            @Override
            public void onFailure(String response) {
                Log.i("cpd","uploadApplist onFailure:"+response);
            }
        });


        findViewById(R.id.btn_task).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,TaskActivity.class));
            }
        });



    }
}